# 前端可执行文件
set(CMAKE_AUTOMOC ON)

# 添加前端源文件
add_executable(planner_frontend
    main.cpp
    mainwindow.cpp
    mainwindow.h
)

# 链接Qt库
target_link_libraries(planner_frontend
    Qt6::Widgets
)

# 链接后端可执行文件（确保后端先构建）
add_dependencies(planner_frontend planner_backend)

# 设置可执行文件的输出目录
set_target_properties(planner_frontend PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

# 将后端可执行文件复制到前端输出目录
add_custom_command(TARGET planner_frontend POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:planner_backend> ${CMAKE_BINARY_DIR}/bin
)
